package com.authentications.primary;

import org.slf4j.MDC;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName DefaultUserDetailsService
 * @Author xiezhuocai
 * @Description 默认账号密码
 * @Date 2021/12/18 11:56
 */
public class DefaultUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        //组装用户信息和权限
        UserDetails userDetails = User.withUsername("admin").password("$2a$10$apDrn0/WnSzcBEVP0FFFcObA.prWx8GnzUZQXHvD.T/TUOEg3dSqm").authorities("admin").build();
        return userDetails;
    }
}
